<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript 数组 </title>
</head>
<body>
<!--遍历数组元素-->
<p>最安全方法是使用 "for" 循环：</p>

<p id="demo"></p>

<script>
  var fruits, text, fLen, i;
  fruits = ["Banana", "Orange", "Apple", "Mango"];
  fLen = fruits.length;

  text = "<ul>";

  for(i=0;i<fLen;i++){
    text+="<li>"+fruits[i]+"</li>";
  }
  text+="</ul>";

  document.getElementById("demo").innerHTML = text;
  </script>
</body>
</html>


<!--
<ul>
  <li>Banana</li>
  <li>Orange</li>
  <li>Apple</li>
  <li>Mango</li>
</ul>
-->

